.VideoLipSync {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px;
  max-height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth;

  @media (max-width: 768px) {
    padding: 16px;

    .content {
      padding: 0;
    }

    :global(.p-6) {
      padding: 0 !important;
    }
  }

  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;

    &:hover {
      background: #555;
    }
  }

  .content {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding-bottom: 20px;

    @media (max-width: 768px) {
      grid-template-columns: 1fr;
      gap: 16px;
    }
  }

  .leftSection {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .uploadSection {
    display: flex;
    flex-direction: column;
    gap: 16px;

    @media (max-width: 768px) {
      .uploadItem {
        padding: 12px;
      }
    }
  }

  .uploadItem {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;

    span {
      font-size: 14px;
      color: white;
      font-weight: 500;
    }

    input {
      padding: 8px;
      border: 1px solid #ddd;
      border-radius: 4px;
      background: white;

      &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background: #f1f3f5;
      }

      &:hover:not(:disabled) {
        border-color: #1890ff;
      }
    }

    .fileName {
      margin-top: 4px;
      font-size: 14px;
      color: #666;
      display: flex;
      align-items: center;
      gap: 8px;

      .progress {
        margin-left: auto;
        font-size: 12px;
        color: #1890ff;
        background: rgba(24, 144, 255, 0.1);
        padding: 2px 8px;
        border-radius: 4px;
      }
    }
  }

  .previewContainer {
    position: relative;
    margin-top: 8px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;

    .previewVideo,
    .resultVideo {
      width: 100%;
      max-height: 300px;
      object-fit: contain;
      display: block;
    }

    .previewAudio {
      width: 100%;
      margin: 10px 0;

      &::-webkit-media-controls-panel {
        background: rgba(255, 255, 255, 0.9);
      }
    }

    .controls {
      position: absolute;
      bottom: 16px;
      left: 16px;
      display: flex;
      gap: 8px;
      z-index: 2;
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    &:hover .controls {
      opacity: 1;
    }

    @media (max-width: 768px) {
      margin: 8px -12px;
      border-radius: 0;
    }
  }

  .controlButton {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s;

    &:hover {
      background: rgba(0, 0, 0, 0.8);
      transform: scale(1.05);
    }

    &:active {
      transform: scale(0.95);
    }

    svg {
      width: 20px;
      height: 20px;
    }
  }

  .generateButton {
    padding: 12px 24px;
    background-color: #1890ff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);

    &:hover:not(.disabled) {
      background-color: #40a9ff;
      transform: translateY(-1px);
    }

    &:active:not(.disabled) {
      transform: translateY(1px);
    }

    &.disabled {
      background-color: #d9d9d9;
      cursor: not-allowed;
      opacity: 0.7;

      &:hover {
        background-color: #d9d9d9;
        transform: none;
      }
    }
  }

  .result {
    height: 100%;
    display: flex;
    flex-direction: column;

    .resultHeader {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;

      @media (max-width: 768px) {
        padding: 0 16px;
      }
    }

    .resultTitle {
      font-size: 16px;
      font-weight: 500;
      color: #333;
    }

    .downloadButton {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      background-color: #52c41a;
      color: white;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 500;
      transition: all 0.2s;

      &:hover {
        background-color: #73d13d;
      }

      &:active {
        transform: scale(0.98);
      }

      svg {
        width: 16px;
        height: 16px;
      }
    }

    .previewContainer {
      flex: 1;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

      .resultVideo {
        height: 100%;
        max-height: none;
      }
    }
  }

  // 响应式整
  @media (max-width: 1024px) {
    .content {
      grid-template-columns: 1fr;
    }

    .result .previewContainer .resultVideo {
      max-height: 300px;
    }
  }

  @media (max-width: 768px) {
    padding: 12px;

    .uploadItem {
      padding: 12px;
    }

    .previewContainer {
      .controls {
        bottom: 8px;
        left: 8px;
      }
    }

    .controlButton {
      width: 32px;
      height: 32px;

      svg {
        width: 16px;
        height: 16px;
      }
    }

    .generateButton {
      padding: 10px 20px;
      font-size: 14px;
    }
  }

  // 添加音频输入选项样式
  .audioInputOptions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;

    input {
      flex: 1; // 让input占据剩余空间
      min-width: 0; // 防止input超出容器
    }

    .ttsButton {
      white-space: nowrap; // 防止文字换行
      flex-shrink: 0; // 防止按钮被压缩
      padding: 8px 16px;
      background-color: #4a5568;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.2s;

      &:hover {
        background-color: #2d3748;
      }

      &:disabled {
        background-color: #cbd5e0;
        cursor: not-allowed;
      }
    }
  }

  // 添加模态框样式
  .modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;

    @media (max-width: 768px) {
      padding: 16px;

      .modalContent {
        width: 100%;
        margin: 0;
      }
    }
  }

  .modalContent {
    background-color: white;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

    h3 {
      margin-top: 0;
      margin-bottom: 20px;
      font-size: 18px;
      font-weight: 500;
      color: #1a202c;
    }
  }

  .formGroup {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    position: relative;

    .labelWithIcon {
      display: flex;
      align-items: center;
      gap: 4px;

      label {
        min-width: auto;
        padding-top: 0;
        margin: 0;
      }

      .infoIcon {
        cursor: help;
        color: #666;
        transition: color 0.3s;

        &:hover {
          color: #1677ff;
        }
      }
    }

    input {
      width: 100%;
      padding: 8px;
      border-radius: 4px;
      border: 1px solid #ddd;

      &:focus {
        outline: none;
        border-color: #1677ff;
      }
    }

    select {
      flex: 1;
      padding: 8px;
      border-radius: 4px;
      border: 1px solid #ddd;
    }

    .cloneButton {
      flex-shrink: 0;
      padding: 8px 16px;
      background-color: #1677ff;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: background-color 0.3s;

      &:hover {
        background-color: #4096ff;
      }

      &:disabled {
        background-color: #ccc;
        cursor: not-allowed;
      }
    }

    @media (max-width: 768px) {
      margin-bottom: 12px;

      input,
      select,
      textarea {
        font-size: 16px;
      }
    }
  }

  .tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 300px;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    transform: translateY(-50%);

    &.visible {
      visibility: visible;
      opacity: 1;
    }

    &::before {
      content: '';
      position: absolute;
      left: -4px;
      top: 50%;
      transform: translateY(-50%);
      border-width: 4px;
      border-style: solid;
      border-color: transparent rgba(0, 0, 0, 0.8) transparent transparent;
    }

    ul {
      margin: 5px 0;
      padding-left: 20px;

      li {
        margin-bottom: 3px;
      }
    }

    .example {
      margin-top: 5px;
      color: #1677ff;
    }
  }

  .infoIcon {
    cursor: help;
    color: #666;
    margin-left: 5px;
    transition: color 0.3s;

    &:hover {
      color: #1677ff;
    }
  }

  .modalButtons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;

    button {
      padding: 8px 16px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.2s;
      font-size: 14px;
      font-weight: 500;
    }
  }

  .cancelButton {
    background-color: #e2e8f0;
    color: #4a5568;

    &:hover {
      background-color: #cbd5e0;
    }
  }

  .submitButton {
    background-color: #4a5568;
    color: white;

    &:hover {
      background-color: #2d3748;
    }
  }

  // 响应式调整
  @media (max-width: 768px) {
    .modalContent {
      padding: 16px;
      width: 95%;
    }

    .formGroup {
      margin-bottom: 12px;

      textarea {
        min-height: 80px;
      }
    }

    .modalButtons {
      margin-top: 16px;

      button {
        padding: 6px 12px;
        font-size: 13px;
      }
    }
  }

  // 添加标题和备注样式
  .header {
    text-align: center;
    margin-bottom: 24px;

    h2 {
      font-size: 24px;
      font-weight: 600;
      color: white;
      margin-bottom: 8px;
    }

    .note {
      font-size: 14px;
      color: rgba(255, 255, 255, 0.8);
      margin: 0;
    }
  }

  .audioSourceButtons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
  }

  .recordButton {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background-color: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;

    &:hover {
      background-color: #2d3748;
    }

    &.recording {
      background-color: #e53e3e;

      &:hover {
        background-color: #c53030;
      }
    }
  }

  .recordedAudio {
    width: 100%;
    margin-top: 10px;
  }

  .audioSourceTabs {
    display: flex;
    gap: 1px;
    background-color: #e2e8f0;
    padding: 2px;
    border-radius: 6px;
    margin-bottom: 12px;
    width: 100%; // 确保宽度占满

    .tabButton {
      flex: 1;
      padding: 8px 16px;
      border: none;
      background-color: transparent;
      color: #4a5568;
      cursor: pointer;
      border-radius: 4px;
      transition: all 0.2s;
      font-size: 14px;
      font-weight: 500;

      &:hover {
        background-color: rgba(255, 255, 255, 0.5);
      }

      &.active {
        background-color: white;
        color: #1a202c;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      }
    }
  }

  .audioSourceContent {
    width: 100%; // 确保宽度占满
    background-color: #f8fafc;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-top: 12px; // 增加与tab的间距

    input[type='file'] {
      width: 100%;
      padding: 8px;
      background-color: white;
      border: 1px dashed #cbd5e0;
      border-radius: 4px;
      cursor: pointer;

      &:hover {
        border-color: #4a5568;
      }

      &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }
    }

    @media (max-width: 768px) {
      padding: 12px;
    }
  }

  .recordingSection {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%; // 确保宽度占满

    .recordButton {
      width: 100%; // 让按钮宽度占满
      display: flex;
      align-items: center;
      justify-content: center; // 居中对齐
      gap: 8px;
      padding: 12px 24px;
      background-color: #4a5568;
      color: white;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s;
      font-size: 14px;
      font-weight: 500;

      &:hover {
        background-color: #2d3748;
        transform: translateY(-1px);
      }

      &.recording {
        background-color: #e53e3e;
        animation: pulse 2s infinite;

        &:hover {
          background-color: #c53030;
        }
      }
    }

    .recordedAudio {
      width: 100%;
      margin-top: 8px;
      border-radius: 4px;
      background-color: white;
    }
  }

  @keyframes pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    70% {
      box-shadow: 0 0 0 10px rgba(229, 62, 62, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
  }

  // 添加音频来源容器样式
  .audioSourceContainer {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
    flex: 1;
  }

  .audioSourceTabs {
    display: flex;
    gap: 1px;
    background-color: #e2e8f0;
    padding: 2px;
    border-radius: 6px;
    width: 100%;

    .tabButton {
      flex: 1;
      padding: 8px 16px;
      border: none;
      background-color: transparent;
      color: #4a5568;
      cursor: pointer;
      border-radius: 4px;
      transition: all 0.2s;
      font-size: 14px;
      font-weight: 500;

      &:hover {
        background-color: rgba(255, 255, 255, 0.5);
      }

      &.active {
        background-color: white;
        color: #1a202c;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      }
    }
  }

  .audioSourceContent {
    width: 100%;
    background-color: #f8fafc;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;

    input[type='file'] {
      width: 100%;
      padding: 8px;
      background-color: white;
      border: 1px dashed #cbd5e0;
      border-radius: 4px;
      cursor: pointer;

      &:hover {
        border-color: #4a5568;
      }

      &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }
    }
  }
}
